function [compoundStructure] = get_compound_information(compound)

    listOfReactions = [];
    compoundStructure= struct('ENTRY','******','NAME','******', ...
                'FORMULA','******', 'REACTIONS', listOfReactions);
    compounds = [];
    isFound = false;
    try
        compounds = evalin('base', 'compounds'); 
    catch
        assignin('base', 'compounds', compounds);
    end 

    for i=1:length(compounds)
        if strcmp(compounds(i).ENTRY, compound)
            compoundStructure = compounds(i);
            isFound = true;
            break;
        end
    end
    
    if ~isFound
         try
            url_c = strcat('http://rest.kegg.jp/get/',compound);

            [keggDataString, status] = urlread(url_c);
            if status == 1  
                matchString = regexp(keggDataString,'.*','match','dotexceptnewline');
                for i=1:length(matchString)
                    if regexp(matchString{i},'ENTRY')
                        try
                            compoundStructure.ENTRY = compound; 
                        catch err
                            disp(err);
                        end
                    elseif regexp(matchString{i},'NAME')
                       try
                            currentString = regexprep(matchString{i},' ','');
                            compoundStructure.NAME = currentString(5: length(currentString));
                       catch err
                           disp(err);
                       end
                    elseif regexp(matchString{i},'FORMULA')
                       try
                            currentString = regexprep(matchString{i},' ','');
                            compoundStructure.FORMULA = currentString(8:length(currentString));
                       catch err
                           disp(err);
                       end
                    elseif regexp(matchString{i},'REACTION')
                       try
                           lastElementIndex = i;
                           for j=1:length(matchString)
                                if regexp(matchString{j},'PATHWAY')
                                   lastElementIndex = j;
                                end 
                           end
                           reactions = {};
                           if ~isequal(lastElementIndex,i)
                               for j = i:lastElementIndex - 1
                                    reactions = strtrim(strrep(matchString(j),'REACTION',''));
                                    line = regexp(reactions{1},' ','split');
                                    listOfReactions = [listOfReactions, line];
                               end
                           else
                               reactions = strtrim(strrep(matchString(i),'REACTION',''));
                               line = regexp(reactions{1},' ','split');
                               listOfReactions = [listOfReactions, line];
                           end 
                           compoundStructure.REACTIONS = listOfReactions;
                       catch err
                           disp(err);
                       end
                    end

                end      
                compounds = [compounds, compoundStructure];
                assignin('base', 'compounds', compounds);
            else
                disp(strcat('error:', url_c));
            end
        catch err
                disp(err);
        end
    end
end